package com.dragon.logical.service.auth.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dragon.repository.entity.OperationLog;
import com.dragon.repository.mapper.OperationLogMapper;
import com.dragon.logical.service.auth.IOperationLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户操作日志 服务实现类
 * </p>
 *
 * @author sy
 * @since 2023-06-16
 */
@Service
public class OperationLogServiceImpl extends ServiceImpl<OperationLogMapper, OperationLog> implements IOperationLogService {

    @Autowired
    OperationLogMapper mapper;



    @Override
    public Page<OperationLog> selectPage(Integer adminId,String username,Integer page,Integer limit){
        Page<OperationLog> operationLogPage = new Page<>(page,limit);
        Page<OperationLog> list = mapper.selectPageByUsernameOrAdminId(operationLogPage,adminId,username);
        return list;
    }

    @Override
    public void addLogs(OperationLog operationLog){
        mapper.insert(operationLog);
    }
}
